package net.mcreator.infinite_storage.procedure;

import net.minecraft.world.World;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.Entity;

import net.mcreator.infinite_storage.InfiniteStorageModVariables;
import net.mcreator.infinite_storage.ElementsInfiniteStorageMod;

import java.util.Map;
import java.util.HashMap;

@ElementsInfiniteStorageMod.ModElement.Tag
public class ProcedureIscfgCmdDo extends ElementsInfiniteStorageMod.ModElement {
	public ProcedureIscfgCmdDo(ElementsInfiniteStorageMod instance) {
		super(instance, 67);
	}
	static Map<String, Object> $_dependencies = new HashMap<>();
	public static void executeProcedure(Map<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			return;
		}
		if (dependencies.get("cmdparams") == null) {
			return;
		}
		if (dependencies.get("world") == null) {
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		HashMap cmdparams = (HashMap) dependencies.get("cmdparams");
		World world = (World) dependencies.get("world");
		String StringTemp = "";
		if ((((new Object() {
			public String getText() {
				String param = (String) cmdparams.get("0");
				if (param != null) {
					return param;
				}
				return "";
			}
		}.getText())).equals((new TextComponentTranslation("cmd.iscfg.tip.1").getUnformattedComponentText())))) {
			if ((((new Object() {
				public String getText() {
					String param = (String) cmdparams.get("1");
					if (param != null) {
						return param;
					}
					return "";
				}
			}.getText())).equals("true"))) {
				InfiniteStorageModVariables.MapVariables.get(world).BagState = (boolean) (true);
				InfiniteStorageModVariables.MapVariables.get(world).syncData(world);
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.1_1").getUnformattedComponentText())), (false));
				}
			} else if ((((new Object() {
				public String getText() {
					String param = (String) cmdparams.get("1");
					if (param != null) {
						return param;
					}
					return "";
				}
			}.getText())).equals("false"))) {
				InfiniteStorageModVariables.MapVariables.get(world).BagState = (boolean) (false);
				InfiniteStorageModVariables.MapVariables.get(world).syncData(world);
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.1_2").getUnformattedComponentText())), (false));
				}
			} else {
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.1_3").getUnformattedComponentText())), (false));
				}
			}
		}
		if ((((new Object() {
			public String getText() {
				String param = (String) cmdparams.get("0");
				if (param != null) {
					return param;
				}
				return "";
			}
		}.getText())).equals((new TextComponentTranslation("cmd.iscfg.tip.2").getUnformattedComponentText())))) {
			if ((new Object() {
				int convert(String s) {
					try {
						return Integer.parseInt(s.trim());
					} catch (Exception e) {
					}
					return 0;
				}
			}.convert((new Object() {
				public String getText() {
					String param = (String) cmdparams.get("1");
					if (param != null) {
						return param;
					}
					return "";
				}
			}.getText())) > 0)) {
				InfiniteStorageModVariables.MapVariables.get(world).NeedLevel = (double) new Object() {
					int convert(String s) {
						try {
							return Integer.parseInt(s.trim());
						} catch (Exception e) {
						}
						return 0;
					}
				}.convert((new Object() {
					public String getText() {
						String param = (String) cmdparams.get("1");
						if (param != null) {
							return param;
						}
						return "";
					}
				}.getText()));
				InfiniteStorageModVariables.MapVariables.get(world).syncData(world);
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity)
							.sendStatusMessage(
									new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.2_1",
											(InfiniteStorageModVariables.MapVariables.get(world).NeedLevel)).getUnformattedComponentText())),
									(false));
				}
			} else {
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.2_2").getUnformattedComponentText())), (false));
				}
			}
		}
		if ((((new Object() {
			public String getText() {
				String param = (String) cmdparams.get("0");
				if (param != null) {
					return param;
				}
				return "";
			}
		}.getText())).equals((new TextComponentTranslation("cmd.iscfg.tip.3").getUnformattedComponentText())))) {
			if ((new Object() {
				int convert(String s) {
					try {
						return Integer.parseInt(s.trim());
					} catch (Exception e) {
					}
					return 0;
				}
			}.convert((new Object() {
				public String getText() {
					String param = (String) cmdparams.get("1");
					if (param != null) {
						return param;
					}
					return "";
				}
			}.getText())) > 0)) {
				InfiniteStorageModVariables.MapVariables.get(world).NeedLevel = (double) new Object() {
					int convert(String s) {
						try {
							return Integer.parseInt(s.trim());
						} catch (Exception e) {
						}
						return 0;
					}
				}.convert((new Object() {
					public String getText() {
						String param = (String) cmdparams.get("1");
						if (param != null) {
							return param;
						}
						return "";
					}
				}.getText()));
				InfiniteStorageModVariables.MapVariables.get(world).syncData(world);
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.3_1").getUnformattedComponentText())), (false));
				}
			} else {
				if (entity instanceof EntityPlayer && !entity.world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(
							new TextComponentString((new TextComponentTranslation("cmd.iscfg.msg.3_2").getUnformattedComponentText())), (false));
				}
			}
		}
	}
}
